package com.neusoft.nep.SystemAdminstrator.Controller;


import com.neusoft.nep.SystemAdminstrator.entity.SystemFeedback;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;

import java.io.IOException;
import java.net.URL;

public class FeedbackinfoController {
    @FXML
    private Button btn_out;
    @FXML
    private Label labID;
    public void initialize(){
        labID.setText("系统管理员：" + loginController.currentLoginID);
    }
    public void OUT(ActionEvent actionEvent){
        System.exit(0);
    }
    @FXML
    private Button btn_back;
    public void toback(ActionEvent event) throws IOException {
            FXMLLoader fxmlLoader = new FXMLLoader();
            URL url = getClass().getResource("../View/publicList.fxml");
            fxmlLoader.setLocation(url);
            Parent root = fxmlLoader.load();
            Scene scene = btn_back.getScene();
            scene.setRoot(root);
            Stage stage = (Stage) scene.getWindow();
            stage.show();

    }
    SystemFeedback systemFeedback;
    private void initDataToUI(){
        if (systemFeedback != null) {
            infoIdValue.setText(String.valueOf(systemFeedback.getIndex()));
            feedbackPersonValue.setText(systemFeedback.getName() + " " + systemFeedback.getSex() + " " + systemFeedback.getBirthday());
            phoneValue.setText(systemFeedback.getPhoneNumber());
            addressValue.setText(systemFeedback.getAddress());
            descriptionValue.setText(systemFeedback.getDescription());
            levelValue.setText(systemFeedback.getAqiLevel());
            feedbackTimeValue.setText(systemFeedback.getTime());
        }
    }
    public void setSystemFeedback(SystemFeedback systemFeedback){
        this.systemFeedback = systemFeedback;
        initDataToUI();
    }
    @FXML
    private Label infoIdValue;
    @FXML
    private Label feedbackPersonValue;
    @FXML
    private Label phoneValue;
    @FXML
    private Label addressValue;
    @FXML
    private Label descriptionValue;
    @FXML
    private Label levelValue;
    @FXML
    private Label feedbackTimeValue;
    @FXML
    private MenuItem mi_PSL;
    public void  PSLClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/publicList.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
    @FXML
    private MenuItem mi_AQI;
    public void AQIListClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/AQImakesure.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
    @FXML
    private MenuItem mi_PGC;
    public void PGCClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/ProvincialGroupComponentItemInspectionStatistics.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
    @FXML
    private MenuItem mi_AqiDistribute;
    public void AqiDistributeClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/AqiDistributeTotalStatisView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
    @FXML
    private MenuItem mi_Other;
    public void OtherClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/OtherTotalStatisView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
    @FXML
    private MenuItem mi_AqiTrendTotal;
    public void AqiTrendClick(ActionEvent event) throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader();
        URL url = getClass().getResource("../View/AqiTrendTotalStatisView.fxml");
        fxmlLoader.setLocation(url);
        Parent root = fxmlLoader.load();
        Scene scene = btn_out.getScene();
        scene.setRoot(root);
        Stage stage = (Stage) scene.getWindow();
        stage.show();
    }
}
